package com.java.day07.modifier;

public class User {

    public User(){
        cont++;
    }

    //User类被调用次数
    public static int cont = 0;

    static{
        System.out.println("静态代码块被调用");
//        cont = 10;
        method1();//对一些静态属性进行赋值

    }

    public static void method1(){
        System.out.println("静态方法被调用");
    }

    public static void main(String[] args) {
        User user1 = new User();
        User user2 = new User();
        System.out.println("生成了"+cont+"次User对象");
        User user3 = new User();
        System.out.println("生成了"+cont+"次User对象");


    }
}
